package ohtu;

import java.awt.*;
import java.util.ArrayList;
import javax.swing.JTable;
import javax.swing.table.*;

public class OhtuTableRenderer extends DefaultTableCellRenderer {

	public ArrayList<Point> toBeColouredCells;

	public OhtuTableRenderer() {
		toBeColouredCells = new ArrayList<Point>();
	}

	@Override
	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
		Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

		if (toBeColouredCells.contains(new Point(row, column))) {
			c.setBackground(new Color(0, 255, 0));
		} else {
			c.setBackground(new Color(255, 255, 255));
		}

		return c;
	}
}
